<style lang="less">
  .customer-manage{
    .el-form-item {
      margin: 0px 20px 15px 20px;
    }

    .f-w70 {
      width: 50%;
    }

    .el-collapse {
      border: 0px;
      .el-collapse-item {
        border: 1px solid #dfe6ec;
        margin-bottom: 15px;
        .el-collapse-item__header {
          font-weight: bold;
          .el-collapse-item__header__arrow {
            display: none;
          }
        }
        .el-collapse-item__content {
          padding-bottom: 0px;
        }
        .el-collapse-item__wrap {
          border-bottom: 0px;
        }
      }
    }

    .el-row {
      margin-bottom: 20px;
      &:last-child {
        margin-bottom: 0;
      }
    }

    .el-col {
      border-radius: 4px;
    }

    .bg-purple-dark {
      background: #99a9bf;
    }

    .bg-purple {
      background: #F2F2F2;
    }

    .bg-purple-light {
      background: #e5e9f2;
    }

    .grid-content {
      border-radius: 4px;
      min-height: 36px;
    }

    .row-bg {
      padding: 10px 0;
      background-color: #f9fafc;
    }

    col-none {
      display: none;
    }

    .bg-purple-dark {
      background: #eef1f6;
    }

    .active {
      border: 1px solid red;
    }

    .div-ali-pay {
      background: #ffffff;
      /*border: 1px solid #c8c8c8;*/
      width: 70%;
      line-height: 36px;
      text-align: center;
      border-radius: 4px;
    }

    .f-pb10 {
      padding-bottom: 10px;
    }

    .f-pl10 {
      padding-left: 10px;
    }

    .f-cp {
      cursor: pointer;
    }

    .f-w100 {
      width: 100px;
    }

    .f-h36 {
      height: 36px;
    }
    .dialog-form-label{
      label{
        width: 120px;
      }

    }
    .dialog-form-content{
      width: 350px
    }
  }
</style>

<template>
  <section class="customer-manage">
    <div class="grid-content bg-purple f-mb10">
      <el-row>
        <el-col :span="23" class="f-ml20 f-mt10">
          <div class="grid-content bg-purple">
            <label style="float: left">账户名称 :</label>

            <div style="float: left;font-weight: bold;" id="account1" class="f-ml10">
            </div>

            <div style="float: left" class="f-ml10">
              <el-rate></el-rate>
            </div>

            <div style="float: left;color: #009DD9">3</div>
            <div style="float: left;color: #009DD9">星客户</div>
          </div>

          <div class="grid-content bg-purple" style="color: #B6B6B6">
            <div style="float: left">注册时间: </div>
            <div style="float: left" id="createDate"></div>
            <div style="float: left"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
              &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            </div>
            <div style="float: left">上次登录时间：</div>
            <div style="float: left">{{$store.state.user.loginTime || ''}}</div>
          </div>
          <hr>
          <div class="grid-content bg-purple f-mt10" style=" height:90px">
            <img style="float: left" src="../../assets/newrmb.png"
                 class="f-w20 f-h20">
            <ul style="width: 150px;float: left" class="f-mt0 f-mb0 f-pl20">
              <li style="list-style-type:none;margin-bottom: 5px;font-weight: bold;">账户余额</li>
              <li style="list-style-type:none">
                                <span style="color:#F00"
                                      id="currentAvauseAmt"></span>元
              </li>
            </ul>
            <ul style="width: 150px ;   float: left" class="f-mt0 f-mb0">
              <li style="list-style-type:none; margin-bottom: 5px;font-weight: bold;">可用优惠券</li>
              <li style="list-style-type:none;">
                                <span style="color:#F00" id="countCouponNumber">
                                </span>张
              </li>
            </ul>
          </div>
          <div class="f-mb10">
            <el-button type="primary"  @click="rechargeDialogModel.rechargeDialog = true"
                       style="float: left;margin-left: 70px;margin-top: -30px">充值
            </el-button>
            <el-button type="primary"
                       style="float: left;margin-left: 130px;;margin-top: -30px">提现
            </el-button>
          </div>
        </el-col>
      </el-row>
    </div>
    <el-tabs type="border-card" height="500px" @tab-click="myTabClickMebAcct">
      <el-tab-pane>
        <span slot="label"><i class="el-icon-date"></i> 交易明细</span>
        <search-bar>
          <el-form ref="searchFiltersForm" label-position="right" :model="searchFiltersForm" class="f-bc"
                   label-width="120px">
            <el-row>
              <el-col :span="8">
                <el-form-item label="订单号" prop="orderNumber">
                  <el-input  placeholder="请输入订单编号"
                            v-model="searchFiltersForm.orderNumber"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="交易时间" prop="happenDate">
                  <el-date-picker
                    v-model="searchFiltersForm.happenDate"
                    type="daterange"
                    align="right"
                    placeholder="选择日期范围"
                    :picker-options="pickerOptions2">
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </search-bar>
        <!-- 搜索end -->
        <!-- 操作 -->
        <el-col :span="24" style="margin-bottom: 10px">
          <el-button type="primary" @click="mebAcctTflowResert('searchFiltersForm')" style="float: right">重置
          </el-button>
          <el-button type="primary" @click="handleSearchTFlow" style="float: right;margin-right: 10px">查询</el-button>
          <el-button type="primary" style="float: right">导出EXCEL</el-button>
        </el-col>
        <!--操作end-->
        <!--交易明细表格-->
        <el-table :data="mebAcctTflowTableData" highlight-current-row border
                  @sort-change="sortChangeTFlow"
                  style="width: 100%;">
          <el-table-column type="index" width="100" label="序号">
          </el-table-column>
          <el-table-column prop="orderNumber" label="订单号">
          </el-table-column>
          <el-table-column prop="happenDate" label="交易时间" width="350" >
          </el-table-column>
          <el-table-column prop="payTypeModel.cnDictValname" label="支付方式" width="200" >
          </el-table-column>

          <el-table-column prop="receivableTypeModel.cnDictValname" label="结算方式" width="200" >
          </el-table-column>

          <!--<el-table-column prop="receivableTypeModel.cnDictValname" label="交易类型" width="200" >-->
          <!--</el-table-column>-->

          <el-table-column prop="receivedMoney" label="交易金额(元)" width="250" >
          </el-table-column>
        </el-table>
        <!--列表工具条-->
        <el-col :span="24" class="toolbar">
          <el-pagination
            :current-page="currentPageTFlow"
            :page-size="pageSizeTFlow"
            @size-change="handleSizeChangeTFlow"
            @current-change="handleCurrentChangeTFlow"
            layout="total,sizes,prev, pager, next, jumper"
            :total="totalTFlow" style="float: right">
          </el-pagination>
        </el-col>
      </el-tab-pane>
      <el-tab-pane>
        <span slot="label"><i class="el-icon-picture"></i> 充值记录</span>
        <search-bar>
          <el-row>
            <el-col :span="8">
              <el-form-item label="充值时间">
                <el-date-picker
                  v-model="mebAcctRflowDealDate"
                  type="daterange"
                  align="right"
                  placeholder="选择日期范围"
                  :picker-options="pickerOptions2">
                </el-date-picker>
              </el-form-item>
            </el-col>

          </el-row>
        </search-bar>
        <!-- 操作 -->
        <el-col :span="24" style="margin-bottom: 10px">
          <el-button type="primary" @click="conditionResetRFlow" style="float: right">重置</el-button>
          <el-button type="primary" @click="handleSearchRFlow" style="float: right;margin-right: 10px">查询</el-button>
          <el-button type="primary" style="float: right">导出EXCEL</el-button>
        </el-col>
        <!--操作end-->
        <!--充值明细表格-->
        <el-table :data="mebAcctRflowTableData" highlight-current-row border
                  @sort-change="sortChangeRFlow"
                  style="width: 100%;">
          <el-table-column type="index" width="55" label="序号">
          </el-table-column>
          <el-table-column prop="serialNo" width="350" label="充值流水号">
          </el-table-column>
          <el-table-column prop="channelName" label="充值渠道" width="150" >
          </el-table-column>
          <el-table-column prop="trdOrdId" label="关联第三方订单号/账号" width="350" >
          </el-table-column>
          <el-table-column prop="rechargeAmt" label="交易金额(元)" >
          </el-table-column>
          <el-table-column prop="fundTransactionStatusName" label="状态" width="150" >
          </el-table-column>
          <el-table-column prop="rechargedate" label="充值时间" width="250" >
          </el-table-column>

        </el-table>
        <!--列表工具条-->
        <el-col :span="24" class="toolbar">
          <el-pagination
            :current-page="currentPageRFlow"
            :page-size="pageSizeRFlow"
            @size-change="handleSizeChangeRFlow"
            @current-change="handleCurrentChangeRFlow"
            layout="total,sizes,prev, pager, next, jumper"
            :total="totalRFlow" style="float: right">
          </el-pagination>
        </el-col>
      </el-tab-pane>
      <el-tab-pane>
        <span slot="label"><i class="el-icon-star-off"></i> 优惠券明细</span>
        <search-bar>
          <el-row>
            <el-col :span="8">
              <el-form-item label="优惠券名称">
                <el-input  placeholder="请输入优惠券名称"
                          v-model="couponName" class="f-w70"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="状态">
                <el-select v-model="couponStatusValue" @visible-change="myCouponStatus"
                           placeholder="请选择">
                  <el-option
                    v-for="item in couponStatus"
                    :label="item.cnDictValname"
                    :key="item.dictVal"
                    :value="item.dictVal">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>

            <el-col :span="8">
              <el-form-item label="交易时间">
                <el-date-picker
                  v-model="couponDate"
                  type="daterange"
                  align="right"
                  placeholder="选择日期范围"
                  :picker-options="pickerOptions2">
                </el-date-picker>
              </el-form-item>
            </el-col>

          </el-row>
        </search-bar>

        <!-- 操作 -->
        <el-col :span="24" style="margin-bottom: 10px">
          <el-button type="primary" @click="conditionResetCoupon" style="float: right">重置</el-button>
          <el-button type="primary" @click="handleSearchCoupon" style="float: right;margin-right: 10px">查询</el-button>
          <el-button type="primary" style="float: right">导出EXCEL</el-button>
        </el-col>
        <!--操作end-->

        <!--优惠券明细表格-->
        <!--</el-table>-->
        <el-table :data="couponLogTableData" highlight-current-row border
                  @sort-change="sortChangeCoupon"
                  style="width: 100%;">
          <el-table-column type="index" width="55" label="序号">
          </el-table-column>
          <el-table-column prop="coupon.name" label="优惠券名称" width="300">
          </el-table-column>
          <el-table-column prop="coupon.faceValue" label="面值/折扣" width="100">
          </el-table-column>
          <el-table-column prop="coupon.createDate" label="领取时间" width="200">
          </el-table-column>
          <el-table-column prop="statusName" label="状态">
          </el-table-column>
          <el-table-column prop="orderNumber" label="订单号" width="200">
          </el-table-column>
          <el-table-column prop="orderAmount" label="订单金额(元)" width="130">
          </el-table-column>
          <el-table-column prop="discountAmount" label="优惠后订单金额(元)" width="180">
          </el-table-column>
          <el-table-column prop="useTime" label="交易时间" width="300">
          </el-table-column>
        </el-table>
        <!--列表工具条-->
        <el-col :span="24" class="toolbar">
          <el-pagination
            :current-page="currentPageCoupon"
            :page-size="pageSizeCoupon"
            @size-change="handleSizeChangeCoupon"
            @current-change="handleCurrentChangeCoupon"
            layout="total,sizes,prev, pager, next, jumper"
            :total="totalCoupon" style="float: right">
          </el-pagination>
        </el-col>
      </el-tab-pane>
      <el-tab-pane>
        <span slot="label"><i class="el-icon-document"></i> 地址薄</span>
        <!--工具条-->
        <search-bar>
          <el-row>
            <el-col :span="4">
              <el-form-item label="地址类型 ">
                <el-select v-model="addressTypevalue" placeholder="请选择">
                  <el-option
                    v-for="item in addresstypetotal"
                    :label="item.cnDictValname"
                    :key="item.dictVal"
                    :value="item.dictVal">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="关键字">
                <el-select v-model="keyword" placeholder="请选择">
                  <el-option
                    v-for="item in keyword1"
                    :label="item.label"
                    :key="item.value"
                    :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="" labelWidth="10px">
                <el-input  placeholder="请输入关键字" v-model="keywordValue"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </search-bar>
        <!-- 搜索end -->
        <!-- 操作 -->
        <el-col :span="24" style="margin-bottom: 10px">
          <el-button type="primary" @click="handleAdd" style="float: left">新增</el-button>
          <el-button type="danger" @click="batchDel" style="float: left">删除</el-button>
          <el-button type="primary" @click="resetSearchBar()" style="float: right">重置</el-button>
          <el-button type="primary" @click="handleSearchAddress" style="float: right">查询</el-button>
          <el-button type="primary" style="float: right">导出EXCEL</el-button>
        </el-col>
        <!--操作end-->
        <!--列表-->
        <el-table :data="tableData" highlight-current-row border
                  @sort-change="sortChangeAddress"
                  @selection-change="selsChange"
                  style="width: 100%;">
          <el-table-column type="selection" width="65" label="默认">
          </el-table-column>
          <el-table-column width="65" label="默认">
            <template slot-scope="scope">
              <span v-if="scope.row.isDefault===111002001"><i class="el-icon-check"></i></span>
            </template>
          </el-table-column>
          <el-table-column prop="addtessTypeModel" label="地址类型">
          </el-table-column>
          <el-table-column prop="contactName" label="姓名" width="150" >
          </el-table-column>
          <el-table-column prop="contactPhone" label="手机" width="200" >
          </el-table-column>
          <el-table-column prop="telephone" label="固定电话" width="180" >
          </el-table-column>
          <el-table-column prop="address" label="详细地址" width="250" >
            <template slot-scope="scope">
              {{scope.row.province}}{{scope.row.city}}{{scope.row.county}}{{scope.row.town}}{{scope.row.street}}
            </template>
          </el-table-column>
          <el-table-column label="操作" width="380">
            <template slot-scope="scope">
              <el-button v-if="scope.row.isDefault===111002002" type="warning"
                         @click="setDefault(scope.$index, scope.row)">
                设置默认
              </el-button>
              <el-button v-if="scope.row.isDefault===111002001" type="primary"
                         @click="cancelDefault(scope.$index, scope.row)">
                取消默认
              </el-button>
              <el-button type="success"  @click="handleEdit(scope.$index, scope.row)">编辑
              </el-button>
              <el-button type="warning"  @click="handleDel(scope.$index, scope.row)">删除
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        <!--列表工具条-->
        <el-col :span="24" class="toolbar">
          <el-pagination
            :current-page="currentPageAddress"
            :page-size="pageSizeAddress"
            @size-change="handleSizeChangeAddress"
            @current-change="handleCurrentChangeAddress"
            layout="total,sizes,prev, pager, next, jumper"
            :total="totalAddress" style="float: right">
          </el-pagination>
        </el-col>
        <!--新增/修改 弹窗 -->
        <el-dialog :title="dialogTitle" size="tiny" :visible.sync="myFormVisible" :close-on-click-modal="false">
          <el-form :model="myAddress" :rules="rules" label-width="130px" ref="myAddress">
            <el-form-item label="地址类型" class="dialog-form-label" :rules="[{required: true, message: '请选择地址类型', trigger: 'blur'}]">
              <el-select v-model="myAddress.addressType" class="dialog-form-content" placeholder="请选择地址类型">
                <!--disabled="true" -->
                <el-option
                  v-for="item in $store.getters.ADDRESS_TYPE"
                  :key="item.dictVal"
                  :label="item.cnDictValname"
                  :value="item.dictVal">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="姓名" prop="contactName" class="dialog-form-label">
              <el-input v-model="myAddress.contactName" auto-complete="off" class="dialog-form-content"
                        placeholder="请输入真实姓名"></el-input>
            </el-form-item>
            <el-form-item label="手机" prop="phone" class="dialog-form-label">
              <el-input v-model="myAddress.contactPhone" auto-complete="off" type="number" class="dialog-form-content"
                        placeholder="请输入手机号码"></el-input>
            </el-form-item>
            <el-form-item label="电话" prop="telphone" class="dialog-form-label">
              <el-input v-model="myAddress.telephone" auto-complete="off" type="number" class="dialog-form-content"
                        placeholder="请输入固定电话"></el-input>
            </el-form-item>
            <el-form-item label="通信地址" prop="address" class="dialog-form-label">
              <address-select v-model="addressSelect"
                               placeholder="请选择地址"
                              class="f-w233" style="width: 350px"></address-select>
              <address-update-warn v-if="addressSelect && myAddress.id && addressSelect[3] == null" >
              </address-update-warn>
            </el-form-item>
            <el-form-item prop="street" class="dialog-form-label">
              <el-input auto-complete="off" v-model="myAddress.street" class="dialog-form-content" placeholder="详细地址"></el-input>
            </el-form-item>
            <el-form-item prop="isDefault">
              <el-checkbox v-model="myAddress.isDefault" :true-label="111002001" :false-label="111002002">
                是否默认值
              </el-checkbox>
            </el-form-item>
          </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button @click.native="myFormVisible = false">取消</el-button>
            <el-button type="primary" @click.native="handleSubmit" :loading="submitLoading">提交</el-button>
          </div>
        </el-dialog>
        <!--总end-->
      </el-tab-pane>
    </el-tabs>
    <!--充值Dialog-->
    <el-dialog title="充值" :visible.sync="rechargeDialogModel.rechargeDialog"
               size="tiny">
      <span>余额</span>
      <hr>
      <el-form ref="rechargeDialogModel" :model="rechargeDialogModel" :rules="rechargeDialogModelRules"
               label-width="90px">
        <el-form-item label="充值金额" prop="money">
          <el-input step="0.01" type="number" v-model.number="rechargeDialogModel.money"
                    placeholder="请输入充值金额"></el-input>
        </el-form-item>
      </el-form>
      <br>
      <el-row>
        <el-col :span="24">
          <div class="grid-content bg-purple-dark">
            <div>
              温馨提示：<br>
              1、不支持信用卡方式充值<br>
              2、如您有欠费账单、充值后会优先补扣欠费账单<br>
              3、充值后请及时对支付订单运行结算、以免影响正常服务
            </div>
          </div>
        </el-col>
      </el-row>
      <span slot="footer" class="dialog-footer">
                <el-button @click="rechargeDialogModel.rechargeDialog = false">取 消</el-button>
                <el-button type="primary" @click="rechargeSubmit">确 定</el-button>
            </span>
    </el-dialog>
    <el-dialog title="选择充值渠道" :visible.sync="rechargeDialogModel.selectRechargeDialog"
               size="tiny">
      <el-row>
        <el-col :span="24">
          <div class="grid-content">
            <div>
              <p>第三方充值</p>
              <el-row class="f-pb10 f-pl10">
                <el-col :span="8">
                  <div class="grid-content">
                    <div class="div-ali-pay f-cp f-h36"
                         v-bind:class="{ active: rechargeDialogModel.isAlipay }"
                         @click="payType('aliPay')">
                      <img src="../../assets/aliPayLogo.png" class="f-w100">
                    </div>
                  </div>
                </el-col>
                <el-col :span="8">
                  <div class="grid-content ">
                    <div class="div-ali-pay f-cp f-h36"
                         v-bind:class="{ active: rechargeDialogModel.isUnionPay }"
                         @click="payType('weChatPay')">
                      <img src="../../assets/weChatLogo.png" class="f-w100">
                    </div>
                  </div>
                </el-col>
                <!--<el-col :span="8">-->
                  <!--<div class="grid-content">-->
                    <!--<div class="div-ali-pay f-cp f-h36"-->
                         <!--v-bind:class="{ active: rechargeDialogModel.isWeChatPay }"-->
                         <!--@click="payType('unionPay')">-->
                      <!--<img src="../../assets/unionPayLogo.png" class="f-w100">-->
                    <!--</div>-->
                  <!--</div>-->
                <!--</el-col>-->
              </el-row>
            </div>
          </div>
        </el-col>
        <el-col :span="24">
          <div class="grid-content f-tar">
            <div>
              <p>充值：{{rechargeDialogModel.money}}元</p>
            </div>
          </div>
        </el-col>

      </el-row>
      <span slot="footer" class="dialog-footer">
                <el-button @click="rechargeDialogModel.selectRechargeDialog = false">取 消</el-button>
                <el-button type="primary" @click="confirmRecharge">充 值</el-button>
            </span>
    </el-dialog>
    <el-dialog title="请使用微信客户端扫一扫支付" :visible.sync="rechargeDialogModel.wechatQRCodeDialog"
               size="tiny">
      <div v-html="html">
      </div>
    </el-dialog>
  </section>
</template>

<script>
import {
  searchDictEntitys,
  getUserByUserId,
  getAddressByUserId,
  modifyIsDefault,
  modifyIsNotDefault,
  batchAddressDel,
  saveAddress,
  searchAddresses,
  getUserAddress, getMemberUserAcct,
  searchFundMebacctTflows,
  searchFundMebacctRflows,
  searchCouponLog,
  countAmountByPhoneAndStatus
} from '../../api/customer/maintain';

import {aliPayRecharge, unionRecharge, weChatRecharge, refreshWeChatRecharge} from '../../api/pay/recharge.js';
import {searchDictEntity} from '../../api/system/Dict.js';
import AddressUpdateWarn from '../meb-user/AddressUpdateWarn.vue';
export default{
  components: {
    AddressUpdateWarn
  },
  data () {
    return {
      token: this.$store.state.token,
      memberUserId: this.$route.params.userId,
      html: '',
      currentAvauseAmt: '', // 当前账户总资金
      currentPhone: '', // 当前手机号
      couponName: '', // 优惠券名称
      couponStatusValue: '', // 状态
      couponStatus: [], // 状态
      couponDate: '', // 优惠券有效日期
      couponLogTableData: [], // 优惠券表格
      mebAcctRflowDealDate: '', // 充值时间
      mebAcctRflowTableData: [], // 充值表格
      mebAcctTflowOrderNumber: '', // 订单编号
      mebAcctTflowDealDate: '', // 交易时间
      mebAcctTflowDealTypevalue: '', // 交易 类型
      mebAcctTflowDealType: [], // 交易 类型
      mebAcctTflowTableData: [], // 表格
      // 日期控件
      pickerOptions2: {
        shortcuts: [{
          text: '最近一周',
          onClick (picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '最近一个月',
          onClick (picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '最近三个月',
          onClick (picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
            picker.$emit('pick', [start, end]);
          }
        }]
      },
      //                账户明细  end
      userId: '',
      addresstype: [],
      // 关键字   start
      keyword1: [
        {
          value: 'contactName',
          label: '姓名'
        }, {
          value: 'contactPhone',
          label: '手机号'
        }, {
          value: 'street',
          label: '地址'
        }],
      keyword: '',
      addressSelect: [], // 每个页面用完要清空
      // 关键字   end
      // 搜索栏   start
      addresstypetotal: [], // 大画面的地址类型
      addressTypevalue: '', // 显示值
      keywordValue: '',
      // 搜索栏   end
      listLoading: false,
      // 省-市 显示
      options2: [], // 地址
      o: null,
      props: {
        label: 'name',
        value: 'id',
        children: 'children'
      },
      myFormVisible: false,
      // 新增框--地址  end
      myAddress: {
        'id': null,
        addressId: null,
        addressIds: null,
        'userId': '',
        'contactName': null,
        'contactPhone': null,
        'telephone': null,
        'street': null,
        'country': null,
        'province': null,
        'provinceId': null,
        'city': null,
        'cityId': null,
        options: [],
        'collectAddress': '',
        'county': null,
        'countyId': null,
        'postalCode': null,
        'addressType': null,
        'isDefault': null

      },
      // 验证规则
      rules: {
        contactName: [
          {required: true, message: '请输入姓名', trigger: 'blur'},
          {min: 2, max: 30, message: '长度在 2 到 30 个字符', trigger: 'blur'}
        ]
      },
      dialogTitle: '新增',
      condition: {
        name: '',
        number: ''
      },
      sels: [],
      tableData: [],
      total: 0,
      currentPage: 1,
      pageSize: 10,
      sortProp: null,
      sortOrder: 'ascending',
      submitLoading: false,
      form: {
        'id': null,
        'createDate': null,
        'account': null
      },
      // 充值Dialog所有属性
      rechargeDialogModel: {
        rechargeDialog: false,
        selectRechargeDialog: false,
        wechatQRCodeDialog: false,
        money: '',
        payType: '',
        isAlipay: false,
        isWeChatPay: false,
        isUnionPay: false,
        serialNo: ''
      },
      rechargeDialogModelRules: {
        money: [
          {required: true, message: '请输入充值金额'},
          {type: 'number', min: 0.01, message: '请输入正数'}
        ]
      },
      searchFiltersForm: {
        orderNumber: null,
        happenDate: null
      },
      stopWeChat: '',

      // --------------------------------账户管理下的四个卡片页的分页----------开始 ***********************
      // -----交易明细
      ListLoadingTFlow: false,
      currentPageTFlow: 1,
      pageSizeTFlow: 10,
      totalTFlow: 0,
      sortPropTFlow: null,
      sortOrderTFlow: 'ascending',
      // -----充值记录
      ListLoadingRFlow: false,
      currentPageRFlow: 1,
      pageSizeRFlow: 10,
      totalRFlow: 0,
      sortPropRFlow: null,
      sortOrderRFlow: 'ascending',
      // -----优惠券明细
      ListLoadingCoupon: false,
      currentPageCoupon: 1,
      pageSizeCoupon: 10,
      totalCoupon: 0,
      sortPropCoupon: null,
      sortOrderCoupon: 'ascending',
      // -----地址铺
      ListLoadingAddress: false,
      currentPageAddress: 1,
      pageSizeAddress: 10,
      totalAddress: 0,
      selsAddress: [],
      sortPropAddress: null,
      sortOrderAddress: 'ascending'
      // --------------------------------账户管理下的四个卡片页的分页----------结束 ***********************
    };
  },
  methods: {
    // 切换标签时，四个卡片页查询数据
    myTabClickMebAcct () {
      this.getMebAcctTflowTableData('memberUserId=' + this.$route.params.userId);
      this.getAddressByUserIds();
      this.getMebAcctRflowTableData();
      this.searchCouponLogs();
    },

    //* *********---*******上部账户相关（账户信息、充值、提现。。。。。。）----开始******000000000000000

    // 获取账户信息
    getMemberUserAccts () {
      getMemberUserAcct(this.$route.params.userId).then((res) => {
        document.getElementById('currentAvauseAmt').innerHTML = res.data.obj.avauseAmt;
      });
    },
    // 获取用户信息
    getUserByUserIdS () {
      // 初始化判断ID
      if (this.$route.params.userId !== undefined) {
        getUserByUserId(this.$route.params.userId).then((res) => {
          if (res.data.obj !== '' && res.data.obj !== null) {
            this.currentPhone = res.data.obj.phone;
            document.getElementById('account1').innerHTML = res.data.obj.account;
            document.getElementById('createDate').innerHTML = res.data.obj.createDate;
            //                        this.personage = Object.assign({}, res.data.obj);
          } else {
            this.$message.error(res.data.errorMsg);
          }
        }).catch((error) => {
          console.log(error);
        });
      }
      ;
    },

    // -------充值开始----00001
    // --充值-金额--支付方式选择
    payType (payType) {
      this.rechargeDialogModel.payType = payType;
      switch (this.rechargeDialogModel.payType) {
        case 'aliPay':
          // 选择支付宝充值
          this.rechargeDialogModel.isAlipay = true;
          this.rechargeDialogModel.isUnionPay = false;
          this.rechargeDialogModel.isWeChatPay = false;
          break;
        case 'weChatPay':
          // 选择微信充值
          this.rechargeDialogModel.isAlipay = false;
          this.rechargeDialogModel.isUnionPay = true;
          this.rechargeDialogModel.isWeChatPay = false;
          break;
        case 'unionPay':
          // 选择银联充值
          this.rechargeDialogModel.isAlipay = false;
          this.rechargeDialogModel.isUnionPay = false;
          this.rechargeDialogModel.isWeChatPay = true;
          break;
      }
    },
    confirmRecharge () {
      let userId = this.$route.params.userId;
      switch (this.rechargeDialogModel.payType) {
        case 'aliPay':
          // 支付宝充值
          aliPayRecharge(userId,
            this.rechargeDialogModel.money).then((res) => {
            this.rechargeDialogModel.selectRechargeDialog = true;
            window.document.write(res.data);
          });
          break;
        case 'weChatPay':
          // 微信充值
          weChatRecharge(userId,
            this.rechargeDialogModel.money).then((res) => {
            this.rechargeDialogModel.wechatQRCodeDialog = true;
            this.rechargeDialogModel.serialNo = res.data.obj.serialNo;
            let com = 'http://qr.liantu.com/api.php?text=';
            let url = com + res.data.obj.codeUrl;
            this.html = '<img style="width: 100%;margin: auto" src=' + url + ' />';
            this.stopWeChat = setInterval(() => {
              this.refreshWeChatRecharge(res.data.obj.serialNo);
            }, 5000);
          });
          break;
        case 'unionPay':
          // 银联充值
          unionRecharge(userId,
            this.rechargeDialogModel.money).then((res) => {
            this.rechargeDialogModel.selectRechargeDialog = true;
            window.document.write(res.data);
          });
          break;
      }
    },
    refreshWeChatRecharge (val) {
      let fundTransactionStatus = '';
      refreshWeChatRecharge(val).then((res) => {
        fundTransactionStatus = res.data.obj.fundTransactionStatus;
        console.log(fundTransactionStatus);
        if (fundTransactionStatus === 103003001) {
          clearInterval(this.stopWeChat);
          this.$message.success('充值成功');
          location.reload();
        }
      });
    },
    rechargeSubmit () {
      this.$refs['rechargeDialogModel'].validate((valid) => {
        if (valid) {
          this.rechargeDialogModel.rechargeDialog = false;
          this.rechargeDialogModel.selectRechargeDialog = true;
        }
      });
    },

    // -------充值结束----00001

    // -------获取可用优惠券开始---00003
    countAmountByPhoneAndStatuss () {
      if (this.$route.params.userId !== undefined) {
        getUserByUserId(this.$route.params.userId).then((res) => {
          if (res.data.obj !== '' && res.data.obj !== null) {
            this.currentPhone = res.data.obj.phone;
            this.phone = res.data.obj.phone;
            this.test11();
          } else {
            this.$message.error(res.data.errorMsg);
          }
        }).catch((error) => {
          console.log(error);
        });
      }
      ;
    },
    test11 () {
      let status = 114004001;
      countAmountByPhoneAndStatus(this.currentPhone, status).then((res) => {
        document.getElementById('countCouponNumber').innerHTML = res.data.obj;
      });
    },
    // -------获取可用优惠券结束---00003

    // **********---******上部账户相关（账户信息、充值、提现。。。。。。）----结束*******000000000000000

    //* ********************************************************交易记录列表----开始************************************

    // 查询按钮
    handleSearchTFlow () {
      this.mebAcctTflowTableData = [];
      this.mebAcctTflowSearch();
    },
    // 排序改变
    sortChangeTFlow (o) {
      this.sortPropTFlow = o.prop;
      this.sortOrderTFlow = o.order;
      this.mebAcctTflowSearch();
    },
    // 每页几条操作
    handleSizeChangeTFlow (val) {
      this.pageSizeTFlow = val;
      this.mebAcctTflowSearch();
    },
    // 第几页操作
    handleCurrentChangeTFlow (val) {
      this.currentPageTFlow = val;
      this.mebAcctTflowSearch();
    },
    // 重置交易明细搜索条件
    mebAcctTflowResert (formName) {
      this.$refs[formName].resetFields();
    },
    myMebAcctTflowDealType () {
      let filters = 'dictVal=103001001,103001004';
      searchDictEntity({
        token: this.token,
        filters: filters,
        sorts: ''
      }).then((res) => {
        this.mebAcctTflowDealType = res.data.detailModelList;
      });
    },
    // 多条件检索订单交易信息
    mebAcctTflowSearch () {
      if (this.searchFiltersForm.happenDate !== undefined) {
        if (this.searchFiltersForm.happenDate[0] === null && this.searchFiltersForm.happenDate[1] === undefined && this.searchFiltersForm.orderNumber === null) {
          this.getMebAcctTflowTableData('memberUserId=' + this.$route.params.userId);
          return;
        } else if (this.searchFiltersForm.happenDate[0] === null && this.searchFiltersForm.happenDate[1] === undefined && this.searchFiltersForm.orderNumber !== null) {
          this.getMebAcctTflowTableData('memberUserId=' + this.$route.params.userId + ';orderNumber?' + this.searchFiltersForm.orderNumber);
          return;
        }
      }
      let sf = this.searchFiltersForm;
      let filters = 'memberUserId=' + this.memberUserId + ';';
      for (let s in sf) {
        if (sf[s] === null || sf[s] === undefined || sf[s] === '') {
          continue;
        }

        if (s === 'happenDate') {
          let startDate = (sf[s][0]).Format('yyyy-MM-dd') + ' 00:00:00';
          let endDate = (sf[s][1]).Format('yyyy-MM-dd') + '23:59:59';
          filters += s + '>=' + startDate + ';' + s + '<=' + endDate + ';';
          continue;
        }

        filters += s + '?' + sf[s] + ';';
      }
      if (filters.substring(filters.length - 1, filters.length) === ';') {
        filters = filters.substring(0, filters.length - 1);
      }
      this.getMebAcctTflowTableData(filters);
    },
    // 查询交易明细列表
    getMebAcctTflowTableData (filters) {
      this.listLoadingTFlow = true;
      searchFundMebacctTflows({
        page: this.currentPageTFlow,
        size: this.pageSizeTFlow,
        filters: filters,
        sorts: (this.sortPropTFlow === null ? '' : (this.sortOrderTFlow === 'ascending' ? '-' : '+') + this.sortPropTFlow)
      }).then((res) => {
        this.listLoadingTFlow = false;
        if (res.data.successFlg === true) {
          if (res.data.detailModelList.length > 0) {
            this.mebAcctTflowTableData = res.data.detailModelList;
          } else {
            this.mebAcctTflowTableData = [];
          }
          this.currentPageTFlow = res.data.currPage;
          this.totalTFlow = res.data.totalCount;
          this.pageSizeTFlow = res.data.pageSize;
        } else {
          this.mebAcctTflowTableData = [];
        }
      });
    },
    //* ********************************************************交易记录列表----结束************************************

    //* ****************************************************------------充值记录列表----开始************************************

    // 充值 记录搜索重置
    conditionResetRFlow () {
      this.mebAcctRflowDealDate = '';
    },
    // 查询按钮
    handleSearchRFlow () {
      this.mebAcctRflowTableData = [];
      this.mebAcctRflowSearch();
    },
    // 排序改变
    sortChangeRFlow (o) {
      this.sortPropRFlow = o.prop;
      this.sortOrderRFlow = o.order;
      this.mebAcctRflowSearch();
    },
    // 每页几条操作
    handleSizeChangeRFlow (val) {
      this.pageSizeRFlow = val;
      this.mebAcctRflowSearch();
    },
    // 第几页操作
    handleCurrentChangeRFlow (val) {
      this.currentPageRFlow = val;
      this.mebAcctRflowSearch();
    },
    // 充值 记录  搜索
    mebAcctRflowSearch () {
      this.listLoadingRFlow = true;
      let filters = '';
      // 充值 时间
      if (this.mebAcctRflowDealDate.length > 0 && this.mebAcctRflowDealDate[0] != null && this.mebAcctRflowDealDate[1] != null) {
        let sd = (this.mebAcctRflowDealDate[0]).Format('yyyy-MM-dd') + ' 00:00:00';
        let ed = (this.mebAcctRflowDealDate[1]).Format('yyyy-MM-dd') + ' 23:59:59';
        filters += 'rechargedate>=' + sd + ' g5;';
        filters += 'rechargedate<=' + ed + ' g6;';

        // filters += 'rechargedate>=' + this.mebAcctRflowDealDate[0].toJSON() + ' g5;';
        // filters += 'rechargedate<=' + this.mebAcctRflowDealDate[1].toJSON() + ' g6;';
      }
      filters += 'mebId=' + this.userId + ' g2;';
      searchFundMebacctRflows({
        page: this.currentPageRFlow,
        size: this.pageSizeRFlow,
        filters: filters,
        sorts: (this.sortPropRFlow === null ? '' : (this.sortOrderRFlow === 'ascending' ? '-' : '+') + this.sortPropRFlow)
      }).then((res) => {
        this.listLoadingRFlow = false;
        if (res.data.successFlg === true) {
          if (res.data.detailModelList.length > 0) {
            this.mebAcctRflowTableData = res.data.detailModelList;
          } else {
            this.mebAcctRflowTableData = [];
          }
          this.currentPageRFlow = res.data.currPage;
          this.totalRFlow = res.data.totalCount;
          this.pageSizeRFlow = res.data.pageSize;
        } else {
          this.mebAcctRflowTableData = [];
        }
      });
    },
    getMebAcctRflowTableData () {
      this.listLoadingRFlow = true;
      let filters = 'mebId=' + this.userId;
      searchFundMebacctRflows({
        page: this.currentPageRFlow,
        size: this.pageSizeRFlow,
        filters: filters,
        sorts: (this.sortPropRFlow === null ? '' : (this.sortOrderRFlow === 'ascending' ? '-' : '+') + this.sortPropRFlow)
      }).then((res) => {
        this.listLoadingRFlow = false;
        if (res.data.successFlg === true) {
          if (res.data.detailModelList.length > 0) {
            this.mebAcctRflowTableData = res.data.detailModelList;
          } else {
            this.mebAcctRflowTableData = [];
          }
          this.currentPageRFlow = res.data.currPage;
          this.totalRFlow = res.data.totalCount;
          this.pageSizeRFlow = res.data.pageSize;
        } else {
          this.mebAcctRflowTableData = [];
        }
      });
    },
    //* ****************************************************------------充值记录列表----结束************************************

    //* ****************************************************------******------优惠券明细列表----开始************************************

    // 优惠券状态下拉框
    myCouponStatus () {
      searchDictEntitys('114004').then((res) => {
        if (res.data.detailModelList !== '' && res.data.detailModelList !== null) {
          this.couponStatus = res.data.detailModelList;
        }
      });
    },
    // 搜索栏查询条件重置
    conditionResetCoupon () {
      this.couponName = '';
      this.couponStatusValue = '';
      this.couponDate = '';
    },
    // 查询按钮
    handleSearchCoupon () {
      this.couponLogTableData = [];
      this.couponSearch();
    },
    // 排序改变
    sortChangeCoupon (o) {
      this.sortPropCoupon = o.prop;
      this.sortOrderCoupon = o.order;
      this.couponSearch();
    },
    // 每页几条操作
    handleSizeChangeCoupon (val) {
      this.pageSizeCoupon = val;
      this.handleSearchCoupon();
    },
    // 第几页操作
    handleCurrentChangeCoupon (val) {
      this.currentPageCoupon = val;
      this.handleSearchCoupon();
    },
    // ------------优惠券明细搜索----带检索条件
    couponSearch () {
      let filters = '';
      if (this.couponName !== null && this.couponName !== '') {
        filters += 'coupon.name?' + this.couponName + ' g0;';
      }
      if (this.couponStatusValue !== null && this.couponStatusValue !== '') {
        filters += 'status=' + this.couponStatusValue + ' g1;';
      }
      if (this.couponDate.length > 0 && this.couponDate[0] != null && this.couponDate[1] != null) {
        let sd = (this.couponDate[0]).Format('yyyy-MM-dd') + ' 00:00:00';
        let ed = (this.couponDate[1]).Format('yyyy-MM-dd') + ' 23:59:59';
        filters += 'useTime>=' + sd + ' g5;';
        filters += 'useTime<=' + ed + ' g6;';
        // filters += 'useTime>=' + this.couponDate[0].toJSON() + ' g5;';
        // filters += 'useTime<=' + this.couponDate[1].toJSON() + ' g6;';
      }
      filters += 'phone=' + this.currentPhone + ' g99';
      searchCouponLog({
        page: this.currentPageCoupon,
        size: this.pageSizeCoupon,
        filters: filters,
        sorts: (this.sortPropCoupon === null ? '' : (this.sortOrderCoupon === 'ascending' ? '-' : '+') + this.sortPropCoupon)
        // name: this.couponName
      }).then((res) => {
        //                    this.listLoadingCoupon = false;
        if (res.data.successFlg === true) {
          if (res.data.detailModelList.length > 0) {
            this.couponLogTableData = res.data.detailModelList;
          } else {
            this.couponLogTableData = [];
          }
          this.currentPageCoupon = res.data.currPage;
          this.totalCoupon = res.data.totalCount;
          this.pageSizeCoupon = res.data.pageSize;
        } else {
          this.couponLogTableData = [];
        }
      });
    },
    // 获取优惠券领取记录
    searchCouponLogs () {
      let filters = 'phone=' + this.currentPhone;
      searchCouponLog({
        page: this.currentPageCoupon,
        size: this.pageSizeCoupon,
        filters: filters,
        sorts: (this.sortPropCoupon === null ? '' : (this.sortOrderCoupon === 'ascending' ? '-' : '+') + this.sortPropCoupon)
      }).then((res) => {
        if (res.data.successFlg === true) {
          if (res.data.detailModelList.length > 0) {
            this.couponLogTableData = res.data.detailModelList;
          } else {
            this.couponLogTableData = [];
          }
          this.currentPageCoupon = res.data.currPage;
          this.totalCoupon = res.data.totalCount;
          this.pageSizeCoupon = res.data.pageSize;
        } else {
          this.couponLogTableData = [];
        }
      });
    },
    //* ****************************************************------******------优惠券明细列表----结束************************************

    //* *---------------------------------***********************------------地址薄----开始*****************----------------*******************

    // 重置地址搜索栏
    resetSearchBar () {
      this.addressTypevalue = '';
      this.keywordValue = '';
      this.keyword = '';
    },
    // 查询按钮
    handleSearchAddress () {
      this.tableData = [];
      this.searchAddress();
    },
    // 排序改变
    sortChangeAddress (o) {
      this.sortPropAddress = o.prop;
      this.sortOrderAddress = o.order;
      this.searchAddress();
    },
    // 每页几条操作
    handleSizeChangeAddress (val) {
      this.pageSizeAddress = val;
      this.searchAddress();
    },
    // 第几页操作
    handleCurrentChangeAddress (val) {
      this.currentPageAddress = val;
      this.searchAddress();
    },
    // 多选操作
    selsChange (sels) {
      this.sels = sels;
    },
    // 标签页的搜索地址列表---带条件
    searchAddress () {
      let params = '';
      // 地址类型
      if (this.addressTypevalue !== null && this.addressTypevalue !== '') {
        params += 'addressType=' + this.addressTypevalue + ' g0;';
      }
      // 关键字
      if (this.keyword !== null && this.keyword !== '') {
        if (this.keyword === 'contactName') {
          params += 'contactName?' + this.keywordValue + ' g1;';
        }
        if (this.keyword === 'contactPhone') {
          params += 'contactPhone?' + this.keywordValue + ' g1;';
        }
        if (this.keyword === 'street') {
          // 对街道模糊查询，对省市区县没有查询
          params += 'street?' + this.keywordValue + ' g1;';
        }
      }
      params += 'userId=' + this.userId + ' g2;';
      this.listLoadingAddress = true;
      searchAddresses({
        page: this.currentPageAddress,
        size: this.pageSizeAddress,
        filters: params,
        sorts: (this.sortPropAddress === null ? '' : (this.sortOrderAddress === 'ascending' ? '-' : '+') + this.sortPropAddress)
      }).then((res) => {
        this.listLoadingAddress = false;
        if (res.data.successFlg === true) {
          if (res.data.detailModelList.length > 0) {
            this.tableData = res.data.detailModelList;
          } else {
            this.tableData = [];
          }
          this.currentPageAddress = res.data.currPage;
          this.totalAddress = res.data.totalCount;
          this.pageSizeAddress = res.data.pageSize;
        } else {
          this.tableData = [];
        }
      }).catch(() => {
        this.$message.error('数据有误，查询失败！');
        this.listLoadingAddress = false;
      });
    },
    // ---切换标签页时查询地址列表
    getaddress (userId) {
      this.listLoadingAddress = true;
      getAddressByUserId(this.userId).then((res) => {
        this.listLoadingAddress = false;
        if (res.data.successFlg === true) {
          if (res.data.detailModelList.length > 0) {
            this.tableData = res.data.detailModelList;
          } else {
            this.tableData = [];
          }
          this.currentPageAddress = res.data.currPage;
          this.totalAddress = res.data.totalCount;
          this.pageSizeAddress = res.data.pageSize;
        } else {
          this.tableData = [];
        }
      }).catch(() => {
        this.$message.error('数据有误，查询失败！');
        this.listLoadingAddress = false;
      });
    },
    // 根据userId获取通信地址
    getAddressByUserIds () {
      this.listLoadingAddress = true;
      getAddressByUserId(this.$route.params.userId).then((res) => {
        this.listLoadingAddress = false;
        this.userId = this.$route.params.userId;
        if (res.data.successFlg === true) {
          if (res.data.detailModelList.length > 0) {
            this.tableData = res.data.detailModelList;
          } else {
            this.tableData = [];
          }
          this.currentPageAddress = res.data.currPage;
          this.totalAddress = res.data.totalCount;
          this.pageSizeAddress = res.data.pageSize;
        } else {
          this.tableData = [];
        }
      }).catch(() => {
        this.$message.error('数据有误，查询失败！');
        this.listLoadingAddress = false;
      });
    },

    // ----------地址增、改、删--------------

    // 地址弹框表单重置
    resetForm () {
      for (let p in this.myAddress) {
        this.myAddress[p] = null;
      }
    },
    // 新增地址弹窗
    handleAdd () {
      this.dialogTitle = '新增';
      this.resetForm();
      this.myFormVisible = true;
    },
    // 单条地址编辑弹窗
    handleEdit (index, row) {
      this.dialogTitle = '编辑';
      this.resetForm();
      this.myAddress = Object.assign({}, row);
      getUserAddress(row.id).then((res) => {
        if (res.data.obj !== '') {
          this.addressSelect = [res.data.obj.provinceId, res.data.obj.cityId, res.data.obj.countyId, res.data.obj.townId];
        }
      });

      this.myFormVisible = true;
    },
    addressValue (value) {
      if (value) {
        return value;
      } else {
        return null;
      }
    },
    // 新增修改数据提交
    handleSubmit () {
      if (this.addressSelect != null) {
        if (!this.addressSelect[3]) {
          return this.$message.error('请选择到乡/镇/街道一级地址');
        }
        this.myAddress.provinceId = this.addressValue(this.addressSelect[0]);
        this.myAddress.cityId = this.addressValue(this.addressSelect[1]);
        this.myAddress.countyId = this.addressValue(this.addressSelect[2]);
        this.myAddress.townId = this.addressValue(this.addressSelect[3]);
      }
      // 表单验证
      this.$refs['myAddress'].validate((valid) => {
        if (valid) {
          this.submitLoading = true;
          this.myAddress.userId = this.userId;
          saveAddress(this.myAddress).then((res) => {
            this.submitLoading = false;
            if (res.data.successFlg === true) {
              this.myFormVisible = false;
              this.getaddress(this.userId);
              this.$message.success('恭喜保存/修改成功！');
            } else {
              this.$message.error(res.data.errorMsg);
            }
          }).catch(function (error) {
            console.log(error);
          });
        } else {
          console.log('error submit!!');
          return false;
        }
      });
    },
    // 设置为默认地址
    setDefault (index, row) {
      this.$confirm('确认将该地址设为默认吗?', '提示', {
        type: 'warning'
      }).then(() => {
        modifyIsDefault(row.id, row.userId, row.addressType).then((res) => {
          this.$message({
            message: '恭喜设置成功！',
            type: 'success'
          });
          this.getaddress(this.userId);
        });
      }).catch(() => {
      });
    },
    // 取消默认
    cancelDefault (index, row) {
      this.$confirm('确认不对该地址设置默认吗?', '提示', {
        type: 'warning'
      }).then(() => {
        modifyIsNotDefault(row.id, row.userId, row.addressType).then((res) => {
          this.$message({
            message: '恭喜设置成功！',
            type: 'success'
          });
          this.getaddress(this.userId);
        });
      }).catch(() => {
      });
    },
    // 批量删除地址数据
    batchDel () {
      let id = this.sels.map(item => item.id);
      if (id === '' || id == null) {
        this.$message.error('请选择数据！');
        return;
      }
      this.$confirm('确认删除该地址吗?', '提示', {
        type: 'warning'
      }).then(() => {
        this.listLoading = true;
        batchAddressDel(id).then((res) => {
          this.listLoading = false;
          this.$message({
            message: '恭喜删除成功！',
            type: 'success'
          });
          this.getaddress(this.userId);
        });
      }).catch(() => {
      });
    },
    // 删除单条地址数据
    handleDel (index, row) {
      this.$confirm('确认删除该地址吗?', '提示', {
        type: 'warning'
      }).then(() => {
        this.listLoading = true;
        batchAddressDel([row.id]).then((res) => {
          this.listLoading = false;
          this.$message({
            message: '恭喜删除成功！',
            type: 'success'
          });
          this.getaddress(this.userId);
        });
      }).catch(() => {
      });
    }
    // ----------地址增、改、删--------------

    //* *---------------------------------***********************------------地址薄----结束*****************----------------*******************
  },
  mounted () {
    this.$store.commit('initDict');
    this.getUserByUserIdS();
    this.getAddressByUserIds();
    this.getMebAcctTflowTableData('memberUserId=' + this.$route.params.userId);
    this.getMebAcctRflowTableData();
    this.getMemberUserAccts();
    this.countAmountByPhoneAndStatuss();
  }
};
</script>
